/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author ThinkGem
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { TreeDataModel, TreeModel } from '../model/baseModel';

const { adminPath } = useGlobSetting();

export interface Oper extends TreeModel<Oper> {
  operCode?: string; // 节点编码
  operName?: string; // 节点名称
}

export const operList = (params?: Oper | any) =>
  defHttp.post<Oper[]>({ url: adminPath + '/bas/oper/listData', params });

export const operForm = (params?: Oper | any) =>
  defHttp.get<Oper>({ url: adminPath + '/bas/oper/form', params });

export const operSave = (params?: any, data?: Oper | any) =>
  defHttp.postJson<Oper>({ url: adminPath + '/bas/oper/save', params, data });

export const operCreateNextNode = (params?: Oper | any) =>
  defHttp.get<Oper>({ url: adminPath + '/bas/oper/createNextNode', params });

export const operDisable = (params?: Oper | any) =>
  defHttp.get<Oper>({ url: adminPath + '/bas/oper/disable', params });

export const operEnable = (params?: Oper | any) =>
  defHttp.get<Oper>({ url: adminPath + '/bas/oper/enable', params });

export const operDelete = (params?: Oper | any) =>
  defHttp.get<Oper>({ url: adminPath + '/bas/oper/delete', params });

export const operTreeData = (params?: any) =>
  defHttp.get<TreeDataModel[]>({ url: adminPath + '/bas/oper/treeData', params });

export const manTreeData = (params?: any) =>
  defHttp.get<TreeDataModel[]>({ url: adminPath + '/bas/oper/manTreeData', params });
